package cn.uway.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.MapSessionRepository;
import org.springframework.session.config.annotation.web.http.EnableSpringHttpSession;

@Configuration
@EnableSpringHttpSession
public class HttpSessionConfiguration {

	@Value("${spring.session.maxInactiveIntervalInSeconds}")
	private  Integer  maxInactiveIntervalInSeconds;
	 
	@Bean
	public MapSessionRepository sessionRepository() {
		MapSessionRepository sessionRepository = new MapSessionRepository();
		sessionRepository.setDefaultMaxInactiveInterval(maxInactiveIntervalInSeconds);
		return sessionRepository;
    }
}
